Skip to content

nvidia-peer-memory: prefer in-tree nvidia_peermem over legacy nv_peer_mem - #1390

Open
100-JM wants to merge 3 commits into
NVIDIA:masterfrom
100-JM:fix/nvidia-peer-memory-in-tree
Open

nvidia-peer-memory: prefer in-tree nvidia_peermem over legacy nv_peer_mem#1390
100-JM wants to merge 3 commits into
NVIDIA:masterfrom
100-JM:fix/nvidia-peer-memory-in-tree

Conversation

@100-JM

@100-JM 100-JM commented Sep 3, 2026

Copy link
Copy Markdown

Problem

roles/nvidia-peer-memory assumes the out-of-tree nv_peer_mem DKMS module on DGX systems. Since driver R470.42.01 the equivalent nvidia_peermem module ships in-tree with the driver and nv_peer_mem is not available, so the role fails on current DGX OS:

modprobe: FATAL: Module nv_peer_mem not found in directory /lib/modules/6.8.0-106-generic

There is no variable to disable the role from slurm-cluster.yml; only the nvidia-peer-memory tag.

Reproduced on DGX OS 7.5.0, driver 580.126.20.

Fix

Probe for nvidia_peermem with modinfo. When present, retire any legacy state first — stop and disable nv_peer_mem.service if it exists, unload nv_peer_mem — then load nvidia_peermem, and skip the legacy DKMS/nv_peer_mem/service path. When the in-tree module is absent, behaviour is unchanged.

Every step is idempotent (service_facts gates the service task; modprobe only acts when the module state differs), so a second run reports ok throughout.

Verification

Failure reproduced on DGX OS 7.5.0 / driver 580.126.20. On the same system lsmod shows the in-tree module already loaded (nvidia_peermem 16384 0, used by ib_uverbs), so the new probe takes the in-tree branch and the legacy DKMS/nv_peer_mem path is skipped.

…_mem

Driver R470.42.01 and later ship nvidia_peermem as part of the driver;
the out-of-tree nv_peer_mem DKMS module does not exist there. The role
unconditionally ran dkms autoinstall + modprobe nv_peer_mem on DGX
systems and failed on current DGX OS.

Probe for the in-tree module with modinfo and load it when present;
fall back to the legacy nv_peer_mem path only when it is absent.

Observed on DGX OS 7.5.0 / driver 580.126.20:
  modprobe: FATAL: Module nv_peer_mem not found in directory /lib/modules/6.8.0-106-generic

Signed-off-by: 백지명 <wlaud9805@gmail.com>
@100-JM
100-JM marked this pull request as ready for review September 3, 2026 13:39
The probe task is guarded by the same GPU/DGX conditions as the tasks
that consume its result, so nvidia_peermem_info.rc is only defined on
hosts that reach it. Relying on when-list short-circuiting to avoid the
undefined attribute is easy to break by reordering the conditions.

Default the value to 1 (module absent) so each branch is safe to
evaluate on its own. Behaviour is unchanged on every host.

Signed-off-by: 백지명 <wlaud9805@gmail.com>

@dholt dholt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before loading nvidia_peermem, handle the legacy state explicitly: stop and disable the nv_peer_mem service when present, unload nv_peer_mem as safely required, and then load nvidia_peermem. The transition should also remain successful on a second Ansible run.


Automated triage review (agent-generated on the maintainer's behalf; a human maintainer decides merges).

…eermem

A host upgraded from a pre-R470 driver can still have the nv_peer_mem
service enabled and the module loaded when nvidia_peermem becomes
available in-tree. Stop and disable the service when it exists, unload
nv_peer_mem, then load nvidia_peermem so the two never coexist.

Every step is idempotent: service_facts gates the service task and
modprobe only acts when the module state differs, so a second run
reports ok throughout.

Signed-off-by: 백지명 <wlaud9805@gmail.com>
@100-JM

100-JM commented Sep 6, 2026

Copy link
Copy Markdown
Author

Pushed 45c03ba to address this.

When the in-tree module is available the role now: gathers service_facts; stops and disables nv_peer_mem.service if it exists; unloads nv_peer_mem via modprobe state: absent; then loads nvidia_peermem. The legacy DKMS path is unchanged and still taken when modinfo nvidia_peermem fails.

Second run: service_facts gates the service task, and community.general.modprobe only calls modprobe -r / modprobe when /proc/modules disagrees with the requested state, so every step reports ok once converged. Exercised the branch selection locally against ansible-core 2.17.14 for non-DGX, in-tree with legacy service present, in-tree without it, and legacy-only hosts.

One deliberate choice: if nv_peer_mem is in use and cannot be unloaded, the task fails rather than loading nvidia_peermem alongside it. Happy to relax that if you prefer a warning.

@100-JM

100-JM commented Sep 6, 2026

Copy link
Copy Markdown
Author

@dholt The requested changes are pushed (see the comment above for details) — ready for another look when you have a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants